package com.steven.design.Builder_Pattern.builder;

import lombok.Data;

@Data
public class MikTea {
    private final String type;
    private final String size;
    private final boolean ice;
    private final boolean zhenZhu;

    @Data
    public static class Builder{
        private  String type;
        private  String size="中杯";
        private  boolean ice;
        private  boolean zhenZhu;

        public Builder size(String size){
            this.size=size;
            return this;
        }
        public Builder type(String type){
            this.type=type;
            return this;
        }
        public Builder ice(boolean ice){
            this.ice=ice;
            return this;
        }
        public Builder zhenZhu(boolean zhenZhu){
            this.zhenZhu=zhenZhu;
            return this;
        }
        public MikTea build(){
            return  new MikTea(this);
        }
    }

    private MikTea(Builder builder){
        this.type =builder.type;
        this.size =builder.size;
        this.ice =builder.ice;
        this.zhenZhu =builder.zhenZhu;
    }
    public void show(){
        System.out.println("一份奶茶：珍珠："+zhenZhu+",冰块："+ice +"的"+type+"奶茶");
    }
}
